package com.lhn.netty.netty_demo.inboundhandlerandoutboudhhandler;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ReplayingDecoder;

import java.util.List;

/**
 * @author lhn
 * @date 2025/06/15 16:05
 * @since 1.0.0
 **/
public class MyByteToLongDecoder2 extends ReplayingDecoder<Void> {

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List <Object> out) throws Exception {
        System.out.println("MyByteToLongDecoder2 decode 被调用");
        // 在  ReplayingDecoder 中不需要判断数据是否足够, 内部已经判断了
        out.add(in.readLong());
    }
}